<?php
?>
<form action="#" onSubmit="eqn_lookup(document.getElementById('eqn').value)">
<input id="eqn" type="text" maxlength="12"/><input type="button" onClick="eqn_lookup(document.getElementById('eqn').value)" value="Lookup"/>
</form>

<div id="eqn_results"></div>

<script type="text/javascript">

function eqn_lookup(eqn){
        var url='pages/blade_info.php?';
        url=url+'ip=172.16.3.250';
	url=url+'&eqn='+eqn;
        url=url+'&cmd=eqn_lookup';
        
        //Send the data to the query.php script to update the DB
        var myRequest = new Request({
                url: url, 
                onSuccess: function(response) {
                                //Disable the button if it is successful
				var data = response.split("/");
				var hostname = data[0].replace(" ", "");
				var port = data[1];

				//alert("Host: "+hostname+"\nPort: "+port);				
				
				var myRequest2 = new Request({
					url: 'pages/query.php?hostname='+hostname+'&cmd=ip_lookup',
					onSuccess: function(response1) {
						var output = "Results for: "+hostname+"<br/>";
						output = output+"IP: "+response1+"<br/>Port: "+port;
						document.getElementById("eqn_results").innerHTML = output; 
					}	
				}).send();
             	} 
        }).send();
}
	
</script>

